package grails.goods.goods

import grails.converters.JSON
import grails.goods.base.BaseController
//master --- branches
//jzp --- branches
class GoodsController extends BaseController {

    GoodsService goodsService

    def list() {
        def resource = goodsService.getList()
        render resource as JSON
    }

    def page(){
        def resource = goodsService.getPage(getParameter())
        render resource as JSON
    }

    def add() {
        def saveResult = goodsService.addGoods(getParameter())
        render saveResult as JSON
    }

    def getById(){
        def goodsInfo = goodsService.getGoodsById(getParameter())
        render goodsInfo as JSON
    }

    def update(){
        def updateResult = goodsService.updateGoods(getParameter())
        render updateResult as JSON
    }

    def delete(){
        def deleteResult = goodsService.deleteGoodsById(getParameter())
        render deleteResult as JSON
    }

    def index() {
        render 'hello grails'
    }
}
